<template>
  <div class="responseLevel">
    <el-row>
      <el-col :span="24" style="background-color: #409EFF;color: #fff;padding-left: 30px">
        <h3>响应级别</h3>
      </el-col>
      <el-col :span="24" style="margin: 10px 0">
        <span>当前事故等级：</span>
        <el-select v-model="accidentGradeVal" placeholder="请选择" style="width: 150px">
          <el-option
            v-for="item in accidentGrade"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </el-col>
      <el-col :span="24" style="margin: 10px 0">
        <span>响应级别：</span>
        <el-select v-model="responseLevelVal" placeholder="请选择" style="width: 150px">
          <el-option
            v-for="item in responseLevel"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
        <el-button type="primary" style="margin-left: 50px" @click="levelRule">分级原则</el-button>
      </el-col>
      <el-col :span="24" style="margin: 10px 0">
        <span>专家意见：</span>
        <el-input
          type="textarea"
          :rows="2"
          placeholder="请输入内容"
          style="width: 250px"
          v-model="textareaVal">
        </el-input>
      </el-col>
      <el-col :span="24" style="margin: 10px 0">
        <el-button type="primary" style="margin-right: 70px" @click="report">提交</el-button>
        <el-button type="info">取消</el-button>
      </el-col>
    </el-row>

    <!--响应级别弹出框-->
    <el-dialog title="响应级别分级原则" :visible.sync="levelTableVisible">
      <el-table
        :data="levelTableData"
        style="width: 100%">
        <el-table-column
          prop="level"
          label="等级">
        </el-table-column>
        <el-table-column
          prop="laborLoss"
          label="劳动能力损失(工作日)">
        </el-table-column>
        <el-table-column
          prop="economicLoss"
          label="经济损失(万)">
        </el-table-column>
        <el-table-column
          prop="injuries"
          label="重伤人员(人)">
        </el-table-column>
        <el-table-column
          prop="deadPerson"
          label="死亡人员(人)">
        </el-table-column>
        <el-table-column
          prop="safetyAccidentReportObject"
          label="生产安全事故上报对象(事发地)">
        </el-table-column>
      </el-table>
    </el-dialog>
  </div>
</template>

<script>
  import Qs from 'qs'
  import axios from 'axios';
  export default {
    name: "responseLevel",
    data(){
      return{
        accidentGrade: [{
          value: 'HTML',
          label: 'HTML'
        }, {
          value: 'CSS',
          label: 'CSS'
        }, {
          value: 'JavaScript',
          label: 'JavaScript'
        }],
        accidentGradeVal: [],
        responseLevel: [{
          value: 'HTML',
          label: 'HTML'
        }, {
          value: 'CSS',
          label: 'CSS'
        }, {
          value: 'JavaScript',
          label: 'JavaScript'
        }],
        responseLevelVal: [],
        textareaVal:'',
        levelTableData: [],
        levelTableVisible:false
      }
    },
    methods:{
      report ()  {
        let testUrl='http://192.168.1.111:1479/r-accident-report/save';
        let data = Qs.stringify({"id":2,'callerName':'sd','reportingTime':this.timeValue,'emergencyType':'','emergencyTypeId':'','accidentType':'','accidentTypeId':'','responseLevel':'','responseLevelId':'','accidentVictimsCount':'','casualtyCount':'','accidentPosition':'','latitudeLogtitude':'','flowNumber':'','gPreplanTemplateId':'','filePath':'','planIsStart':'','comment':''});
        console.log(data);
        axios.post(testUrl,data, {headers:{'Content-Type':'application/x-www-form-urlencoded'}})
          .then((response)=>{
            console.log(response);
          }).catch(error => {
          console.log(error);
          alert('网络错误，不能访问');
        })
      },
      levelRule(){
        let testUrl='http://192.168.1.111:1479/r-accident-report/flipListForRClassificationPrinciples';
        let data = '';
        axios.post(testUrl,data, {headers:{'Content-Type':'application/x-www-form-urlencoded'}})
          .then((response)=>{
            console.log(response.data.data.listInfo);
            this.levelTableData=response.data.data.listInfo;
            console.log(this.levelTableData);
          }).catch(error => {
          console.log(error);
          alert('网络错误，不能访问');
        });
        this.levelTableVisible=true;
      }
    }
  }
</script>


<style scoped>
  .responseLevel{
    /*float: right;*/
  }
</style>
